package darknet.application.chat.spec;

import darknet.core.spec.net.Node;
import java.io.IOException;
import java.io.Serializable;
import java.util.Set;

/**
 * A chat channel.
 *
 * @author yoyo
 */
public interface Channel  extends ObservableChannel, Serializable  {

    /**
     * Join the channel.
     */
    void join() throws IOException;


    /**
     * Speak on the channel.
     *
     * @param message
     * @throws IOException
     */
    void speak(String message) throws IOException;

    /**
     * Exit from the channel.
     *
     * @throws IOException
     */
    void exit() throws IOException;

    /**
     * Close the channel. You must be the hoster.
     *
     * @throws IOException
     */
    void close() throws IOException;

    /**
     * Get all nodes connected to the channel.
     * @return
     */
    Set<Node> getNodes();

    /**
     * Get the hoster of the channel.
     * @return
     */
    Node getHoster();

    /**
     * Get the name of the channel.
     * @return
     */
    String getName();

}
